/**
@author		Jong Min, Lee
@date		  02/11/2014
@brief		frame class and producer class

copyright(c) Tae Young Soft. All right reserved. 2014
*/
#pragma once

#include "Taurus_Util/Macros.h"
#include "Taurus_DcmData/Defines.h"

//forward declarations
class CInstance;
class CDcmFrame;

/**
@brief		proxy class for dicom frame
*/
class TAURUS_DCMDATA_EXPORT CFrame
{
private:
  /**
  @brief		default constructor
  */
  CFrame();

  DISALLOW_COPY_AND_ASSIGN(CFrame);

public:
  friend class CFrameProducer;

  /**
  @brief		destructor
  */
  ~CFrame();
  
  /**
  @brief		get pointer to parent instance
  @return		pointer to parent instance if frame has it, nullptr if not
  */
  inline CInstance* getParent() const
  {
    return m_theParent;
  }

  /**
  @brief		set pointer to parent instance
  @param		parent pointer to instance to be parent
  */
  inline void setParent(CInstance* parent)
  {
    m_theParent = parent;
  }

private:
  /**
  @brief		initialize frame
  */
  void init();

  /**
  @brief		destroy frame. this method should be only used in destructor
  */
  void destroy();

private:
  //pointer to parent instance
  CInstance* m_theParent;

  // pointer to dicom frame
  CDcmFrame* m_theDcmFrame;
};

/**
@brief		producer class for frame
*/
class TAURUS_DCMDATA_EXPORT CFrameProducer
{
public:
  /**
  @brief		produce frame
  @param		dcmFrame pointer to dcm frame
  @param    parent pointer to instance to be parent
  @param    outFrame variable in which pointer to new frame is stored
  @return		ERROR_SUCCESS if succeeds, an error code otherwise
  */
  static DWORD produce(CDcmFrame* dcmFrame,
                       CInstance* parent,
                       CFrame*& outFrame);
};